﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:clr="clr-namespace:System;assembly=mscorlib">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="MainTheme.xaml"/>
    </ResourceDictionary.MergedDictionaries>


    <!-- ListBox Styles-->
    <Style TargetType="{x:Type ListBox}">
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ListBoxItem}" >
                    <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}"/>
                    <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}"/>
                    <Setter Property="Margin" Value="2,2,2,2" />
                    <Setter Property="Foreground" Value="{DynamicResource ListBoxItemForeground}"/>
                    <Setter Property="Background" Value="White"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <Grid>
                                    <Rectangle SnapsToDevicePixels="True" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" RadiusX="4" RadiusY="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" x:Name="Rectangle" />
                                    <ContentPresenter Margin="3" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="ContentPresenter" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{DynamicResource ResourceKey=ListBoxItemHover}"/>
                                        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey=ListBoxItemHover}"/>
                                        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=ListBoxItemForegroundInverse}"/>
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Background" Value="{DynamicResource ResourceKey=ListBoxItemSelected}"/>
                                        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey=ListBoxItemSelected}"/>
                                        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=ListBoxItemForegroundInverse}"/>
                                    </Trigger>
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="IsSelected" Value="True"/>
                                            <Condition Property="Selector.IsSelectionActive" Value="False"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Background" Value="{DynamicResource ResourceKey=ListBoxItemSelected}"/>
                                        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey=ListBoxItemSelected}"/>
                                        <Setter Property="Foreground" Value="{DynamicResource ResourceKey=ListBoxItemForegroundInverse}"/>
                                    </MultiTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>

        <Setter Property="Background" Value="White"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush"  Value="{DynamicResource ResourceKey=ListBoxBorderBrush}"/>
    </Style>
</ResourceDictionary>